package test;

import entity.Student;

import java.lang.reflect.Constructor;

/**
 * @author zhu
 * @date 2024-03-25
 */
public class MainTest01 {
    public static void main(String[] args) throws Exception {
        Class<?> clazz= Class.forName("entity.Student");
        Constructor<?> constructor = clazz.getConstructor();
        Object obj = constructor.newInstance();
        if (obj instanceof Student){
            Student stu = (Student) obj;
            stu.sayHello("张三");
        }
    }
}
